<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" type="text/css" href="../../css/aui.css">
    <link rel="stylesheet" type="text/css" href="../../css/aui-slide.css">
    <link rel="stylesheet" type="text/css" href="../../css/api.css">
    <script type="text/javascript" src="../../script/api.js"></script>
</head>

<body>
    <header id="header" class="aui-bar aui-bar-nav aui-bar-pink">
        <a href="" class="aui-pull-left"><span class="aui-iconfont aui-icon-left" onclick="api.closeWin()"></span></a>
        <div class="aui-title">私信</div>
        <a class="aui-pull-right aui-btn aui-btn-outlined">
            <span class="aui-iconfont aui-icon-gear"></span>
        </a>
    </header>
    <section class="aui-chat" id="chart">

    </section>
</body>
<script type="text/javascript">
    apiready = function() {
        var personalLetter = $api.byId('personalLetter');
        var body = {
            token: $api.getStorage('token')
        };
        api.ajax({
            url: 'http://www.mk517.com/webApi/personalLetter.php',
            method: 'post',
            dataType: 'json',
            "headers": {
                "Content-Type": "application/json"
            },
            data: {
                body: body
            }
        }, function(ret, err) {
            if (ret) {

                    $api.byId('chart').innerHTML += '<div class="aui-chat-header">'+ret.letter_time+'</div>' +
                        '<div class="aui-chat-item aui-chat-left">' +
                        '<div class="aui-chat-media">' +
                        '<img id="sellerAvater" src="' + ret.letter_avatar + '" />' +
                        '</div>' +
                        '<div class="aui-chat-inner">' +
                        '<div class="aui-chat-name" id="sellername"><span class="aui-label aui-label-warning">'+ret.letter_name+'</span></div>' +
                        '<div class="aui-chat-content">' +
                        '<div class="aui-chat-arrow"></div>'+ret.letter_content+'</div>' +
                        '<div class="aui-chat-status aui-chat-status-refresh">' +
                        '<i class="aui-iconfont aui-icon-correct aui-text-success"></i></div</div</div>'

                // alert(JSON.stringify(ret));
            } else {
                // alert(JSON.stringify(err));
            }
        });

    }
</script>

</html>
